#pragma once
#include <nice2d/predef.h>
#include <nice2d/metaobject.h>
#include <nice2d/updater.h>
#include <nice2d/component.h>
#include <nice2d/messagereceiver.h>

class Object : public Updater,
               public ComponentSet,
               public MessageReceiver,
               public std::enable_shared_from_this<Object>
{
    DECLARE_ABSTRACT_OBJECT(Object)
public:
    Object();
    virtual ~Object();
public:
    void runAction(ActionPointer action);
    void stopCurrentAction();
    void stopAllActions();

    virtual void update(float deltaTime)override;

    template<class T>
    std::shared_ptr<T> as()
    {
        return std::dynamic_pointer_cast<T>(shared_from_this());
    }
private:
    std::unique_ptr<class ObjectData> data;
};
